package com.sky.service.user.Impl;

import com.sky.dto.SetmealDTO;
import com.sky.mapper.admin.SetmealMapper;
import com.sky.mapper.user.USetmelMapper;
import com.sky.pojo.Setmeal;
import com.sky.service.user.USetmealService;
import com.sky.vo.DishItemVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class USetmealServiceImpl implements USetmealService {
    @Autowired
    private SetmealMapper setmelMapper;
    @Autowired
    private USetmelMapper uSetmelMapper;
    @Override
    @Cacheable(value = "setmeal",key="#p0.categoryId")
    public List<Setmeal> getSetmealByCategoryId(SetmealDTO setmealDTO) {
        Long categoryId = setmealDTO.getCategoryId();
        List<Setmeal> setmealList= setmelMapper.getSetmealByCategoryId(categoryId);

        return setmealList;
    }

    /**
     * 根据套餐id查询包含的菜品
     * @param setmealId
     * @return
     */
    @Override

    public List<DishItemVO> getDishItemBySetmealId(Long setmealId) {
        List<DishItemVO> DishItemList= uSetmelMapper.getDishItemBySetmealId(setmealId);
        return DishItemList;
    }
}
